/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.sun.Entity;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Trasheur
 */
@Entity
@Table(name = "SHIPPINGORDER")
@NamedQueries({@NamedQuery(name = "Shippingorder.findAll", query = "SELECT s FROM Shippingorder s"),
    @NamedQuery(name = "Shippingorder.findBySorderid", query = "SELECT s FROM Shippingorder s WHERE s.sorderid = :sorderid"),
    @NamedQuery(name = "Shippingorder.findByProducttypeid", query = "SELECT s FROM Shippingorder s WHERE s.producttypeid = :producttypeid"),
    @NamedQuery(name = "Shippingorder.findByProductquantity", query = "SELECT s FROM Shippingorder s WHERE s.productquantity = :productquantity"),
    @NamedQuery(name = "Shippingorder.findByEstimatedshippingdate", query = "SELECT s FROM Shippingorder s WHERE s.estimatedshippingdate = :estimatedshippingdate"),
    @NamedQuery(name = "Shippingorder.findByOrdertaken", query = "SELECT s FROM Shippingorder s WHERE s.ordertaken = :ordertaken"),
    @NamedQuery(name = "Shippingorder.findByShippeddate", query = "SELECT s FROM Shippingorder s WHERE s.shippeddate = :shippeddate"),
    @NamedQuery(name = "Shippingorder.findByAmount", query = "SELECT s FROM Shippingorder s WHERE s.amount = :amount"),
    @NamedQuery(name = "Shippingorder.findByIspaid", query = "SELECT s FROM Shippingorder s WHERE s.ispaid = :ispaid"),
    @NamedQuery(name = "Shippingorder.findByAvailability", query = "SELECT s FROM Shippingorder s WHERE s.estimatedshippingdate BETWEEN :estimatedshippeddate AND :shippeddate")})
    public class Shippingorder implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "SORDERID")
    private String sorderid;
    @Column(name = "PRODUCTTYPEID")
    private String producttypeid;
    @Column(name = "PRODUCTQUANTITY")
    private Integer productquantity;
    @Column(name = "ESTIMATEDSHIPPINGDATE")
    @Temporal(TemporalType.DATE)
    private Date estimatedshippingdate;
    @Basic(optional = false)
    @Column(name = "ORDERTAKEN")
    private int ordertaken;
    @Column(name = "SHIPPEDDATE")
    @Temporal(TemporalType.DATE)
    private Date shippeddate;
    @Column(name = "AMOUNT")
    private Float amount;
    @Basic(optional = false)
    @Column(name = "ISPAID")
    private int ispaid;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "orderid")
    private Collection<Invoicefordelaypenalty> invoicefordelaypenaltyCollection;
    @JoinColumn(name = "TRUCKID", referencedColumnName = "TRUCKID")
    @ManyToOne
    private Truck truckid;

    public Shippingorder() {
    }

    public Shippingorder(String sorderid) {
        this.sorderid = sorderid;
    }

    public Shippingorder(String sorderid, int ordertaken, int ispaid) {
        this.sorderid = sorderid;
        this.ordertaken = ordertaken;
        this.ispaid = ispaid;
    }

    public String getSorderid() {
        return sorderid;
    }

    public void setSorderid(String sorderid) {
        this.sorderid = sorderid;
    }

    public String getProducttypeid() {
        return producttypeid;
    }

    public void setProducttypeid(String producttypeid) {
        this.producttypeid = producttypeid;
    }

    public Integer getProductquantity() {
        return productquantity;
    }

    public void setProductquantity(Integer productquantity) {
        this.productquantity = productquantity;
    }

    public Date getEstimatedshippingdate() {
        return estimatedshippingdate;
    }

    public void setEstimatedshippingdate(Date estimatedshippingdate) {
        this.estimatedshippingdate = estimatedshippingdate;
    }

    public int getOrdertaken() {
        return ordertaken;
    }

    public void setOrdertaken(int ordertaken) {
        this.ordertaken = ordertaken;
    }

    public Date getShippeddate() {
        return shippeddate;
    }

    public void setShippeddate(Date shippeddate) {
        this.shippeddate = shippeddate;
    }

    public Float getAmount() {
        return amount;
    }

    public void setAmount(Float amount) {
        this.amount = amount;
    }

    public int getIspaid() {
        return ispaid;
    }

    public void setIspaid(int ispaid) {
        this.ispaid = ispaid;
    }

    public Collection<Invoicefordelaypenalty> getInvoicefordelaypenaltyCollection() {
        return invoicefordelaypenaltyCollection;
    }

    public void setInvoicefordelaypenaltyCollection(Collection<Invoicefordelaypenalty> invoicefordelaypenaltyCollection) {
        this.invoicefordelaypenaltyCollection = invoicefordelaypenaltyCollection;
    }

    public Truck getTruckid() {
        return truckid;
    }

    public void setTruckid(Truck truckid) {
        this.truckid = truckid;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (sorderid != null ? sorderid.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Shippingorder)) {
            return false;
        }
        Shippingorder other = (Shippingorder) object;
        if ((this.sorderid == null && other.sorderid != null) || (this.sorderid != null && !this.sorderid.equals(other.sorderid))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.sun.Entity.Shippingorder[sorderid=" + sorderid + "]";
    }
}
